package com.padakeji.android.pworks.example;

import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import com.padakeji.android.pworks.app.PadaActivity;
import com.padakeji.android.pworks.module.version.VersionController;
import com.padakeji.android.pworks.module.version.entity.VersionInfo;

public class MainActivity extends PadaActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		new Thread(new Runnable() {
			@Override
			public void run() {
				VersionController vc = new VersionController(getApplicationContext()){
					@Override
					public VersionInfo checkRemoteVersion() {
						VersionInfo vi = new VersionInfo();
						vi.versionCode = 2;
						vi.versionName = "1.1";
						vi.downloadLink = "";
						vi.releaseNotes = "1. 高大上的UI设计\n2. 屌炸天的性能提升";
						return vi;
					}
				};
				vc.checkUpdate(true);
			}
		}).start();

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}
}
